home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok33.lha
/
FInOut
/
TestFInOut.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
4KB
|
133 lines
(*****************************************************************
:Program. TestFInOut.mod
:Contents. TestModul für FInOut
:Author. Michael Frieß
:Address. Mühlhaldenweg 16 / 7035 Waldenbuch
:Phone. (0)7157 / 9614
:Shortcut. [mif]
:Version. 1.0
:Date. 26.11.89
:Copyright. PD
:Language. Modula-II
:Translator. M2Amiga
:Imports.ErrorReq [Bne]
*****************************************************************)
MODULE TestFInOut;
FROM FInOut IMPORT file, FOpen, FClose, FRead, FReadString, FSkip,
FReadLongInt, FReadLongCard, FReadCard, FReadInt,
FWrite, FWriteString, FWriteLn,
FWriteLongInt, FWriteLongCard, FWriteCard, FWriteInt,
Eof, error;
FROM InOut IMPORT Write, WriteString, WriteInt, WriteCard,
WriteLn;
FROM ASCII IMPORT eof;
FROM ErrorReq IMPORT Assert;
FROM SYSTEM IMPORT ADR;
CONST TestFile = "T:TestFInOut.Dat";
VAR f: file;
Ch: CHAR;
i, j : INTEGER;
Str : ARRAY [1..200] OF CHAR;
BEGIN
WriteString( "Test of FWritexxx"); WriteLn;
Assert(
ERRxNone = FOpen (f, TestFile, "n"),
ADR("Couldn´t open file"));
Write("A"); FWrite( f, "A");
Write(" "); FWrite( f, " ");
WriteString( "Ein String "); FWriteString( f, "Ein String ");
WriteLn; FWriteLn(f);
WriteCard( 2, 5); FWriteCard(f, 2, 5);
WriteInt( -1, 5); FWriteInt (f, -1, 5);
WriteString(" LongInt"); FWriteLongInt( f, -10, 5);
WriteString(" LongCard"); FWriteLongCard( f, 5, 5);
WriteLn; FWriteLn(f);
WriteCard( 40000, 10); FWriteCard(f, 40000, 10);
WriteInt( -1, 10); FWriteInt (f, -1, 10);
WriteString(" LongInt"); FWriteLongInt( f, -12, 10);
WriteString(" LongCard"); FWriteLongCard( f, 15, 10);
WriteLn; FWriteLn(f);
Assert( FClose( f), ADR("Couldn´t close file"));
WriteString( "Test of FRead"); WriteLn;
Assert(
ERRxNone = FOpen (f, TestFile, "r"),
ADR("Couldn´t open file"));
LOOP
Ch := FRead (f);
IF Ch = eof THEN EXIT END;
END;
Assert( FClose( f), ADR("Couldn´t close file"));
WriteLn;
WriteString( "Test of FSkip and FReadString"); WriteLn;
Assert(
ERRxNone = FOpen (f, TestFile, "r"),
ADR("Couldn´t open file"));
REPEAT
i := INTEGER(FSkip(f));
IF i > 0 THEN
FOR j := 1 TO i DO Write (" ") END
END;
REPEAT
i := INTEGER (FReadString(f, Str));
WriteString (Str);
UNTIL i >= 0;
UNTIL i = 0;
Assert( FClose( f), ADR("Couldn´t close file"));
WriteLn;
WriteString( "Test of FReadInt");
WriteLn;
Assert(
ERRxNone = FOpen (f, TestFile, "r"),
ADR("Couldn´t open file"));
Assert (f # NIL, ADR("Couldn´t open file"));
WHILE NOT Eof(f) DO
WriteInt (FReadInt (f),5);
END;
Assert( FClose( f), ADR("Couldn´t close file"));
WriteLn;
WriteString( "Test of FReadCard");
WriteLn;
Assert(
ERRxNone = FOpen (f, TestFile, "r"),
ADR("Couldn´t open file"));
WHILE NOT Eof(f) DO
WriteInt (FReadCard (f),5);
END;
Assert( FClose( f), ADR("Couldn´t close file"));
WriteLn;
WriteString( "Test of FReadLongInt");
WriteLn;
Assert(
ERRxNone = FOpen (f, TestFile, "r"),
ADR("Couldn´t open file"));
WHILE NOT Eof(f) DO
WriteInt (FReadLongInt (f),10);
END;
Assert( FClose( f), ADR("Couldn´t close file"));
WriteLn;
WriteString( "Test of FReadLongCard");
WriteLn;
Assert(
ERRxNone = FOpen (f, TestFile, "r"),
ADR("Couldn´t open file"));
WHILE NOT Eof(f) DO
WriteInt (LONGINT(FReadLongCard (f)),10);
END;
Assert( FClose( f), ADR("Couldn´t close file"));
WriteLn;
END TestFInOut.